package domain;

/**
 * Created by liukx on 2018-07-24.
 */
public class Wolf extends Animal{

    @Override
    public void move() {
        //寻找四周是否有羊
        int oldX = x;
        int oldY = y;
        switch ((int)(Math.random()*4)){
            case UP:
                if(y<N){
                    y++;
                }
                break;
            case DOWN:
                if(y>0){
                    y--;
                }
                break;
            case LEFT:
                if(x>0){
                    x--;
                }
                break;
            case RIGHT:
                if(x<N){
                    x++;
                }
                break;
        }
        Animal other = coordinate.get(""+x+y);
        if(other != null){
            //此位置已经有其他生物
            if("羊".equals(type)){

            }else {
                x = oldX;
                y = oldY;
            }

        }
        System.out.printf("%s%s从(%n,%n)移动到了(%n,%n)", this.getType(), this.getName(),oldX,oldY,x,y);
    }

    @Override
    void breed() {

    }

    @Override
    void dead() {

    }
}
